<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Delivery Address_{$webname}</title>
<meta name='keywords'    content='{$keywords}'>
<meta name='description' content='{$description}'>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--公共样式结束-->
<!--页面样式开始-->
<link href="__PUBLIC__/Plugins/Validform/css/validform.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_m_address.css" />
<!--页面样式结束-->
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery.SuperSlide.2.1.1.js"></script>
<style>
.addressdl{
	width:400px;
	border:1px solid #ccc;
	box-shadow:1px 2px 4px rgba(0,0,0,0.1) inset;
	display:none;
}
.addressdl dl dd{
	line-height:15px;
	cursor:pointer;
}
.addressdl dl .ditu{
	background:#10AE5C;
	text-align:center;
	cursor:default;
}
.addressdl dl .ditu img{
	cursor:pointer;
}
.addressdl dl dd span{
	display:block;
	padding:5px;
}
.addressdl dl dd:hover{
	background:#0774B9;
	color:#fff;
}
</style>
</head>

<body>
	<div class="zhezhao"></div>
<div class="zz">
	<!--top start-->
	<include file="Public:header" lang="true" />
	<!--top end-->
	<!--content start-->
	<div class="content clearfix">
		<div class="member_left">
			<ul>
				<li><a href="{:U('Member/index')}" class="color_main"><i class=" icon-user"></i>Information</a></li>
				<li><a href="{:U('Member/order_index')}" class="color_main"><i class=" icon-file"></i>Order</a></li>
				<li><a href="{:U('Member/address_index')}" class="hover color_main"><i class=" icon-list"></i>Address</a></li>
				<li><a href="{:U('Member/changePassword')}" class="color_main"><i class=" icon-unlock"></i>Password</a></li>
			</ul>
		</div>
		<!--member_right start-->
		<div class="member_right">
			<div class="mr_title color_main">Delivery Address</div>

			<h1>Edit Delivery Address</h1>
			<form id="address_edit" class="formTable" action="{:U('Member/address_edit')}" method="post">
			<input type="hidden" name='longitude' id='longitude' value="{$detail.longitude}">
			<input type="hidden" name='latitude'  id='latitude'  value="{$detail.latitude}">
			<input type="hidden" name='addressid' id='addressid' value="{$detail.addressid}">
			<input type="hidden" name="id" value="{$detail.id}" />
				<table class="lotab">
					<tbody>
					<tr>
						<th>&nbsp;</th>
						<td><div class="" id="Validform_errortip_div"></div></td>
					</tr>
					<tr>
						<th>Name：</th>
						<td>
							<input type="text" value="{$detail.realname}" id="realname" name="realname" class="myinput"  placeholder="Please enter your Name" 
							datatype="*" nullmsg="Please enter your Name" errormsg="Please enter your Name"/>
						</td>
					</tr>
					<tr>
						<th>Mobile：</th>
						<td>
							<input type="text" value="{$detail.mobile}" id="mobile" name="mobile" class="myinput"  placeholder="Please enter your Mobile" 
							datatype="*11-12" nullmsg="Please enter your Mobile" errormsg="Phone number format error，Example：18588889999 or 01066669999"/>
						</td>
					</tr>
					<tr>
						<th>City：</th>
						<td>
							<select name="city" id="city" style="height:35px;line-height:35px;">
								<option value="">Please select a city</option>
								<option value="850" <eq name="detail.city" value='850'>selected</eq>>Beijing</option>
								<option value="866" <eq name="detail.city" value='866'>selected</eq>>Shanghai</option>
								<option value="867" <eq name="detail.city" value='867'>selected</eq>>Canton</option>
								<option value="930" <eq name="detail.city" value='930'>selected</eq>>Shunyi</option>
							</select>
						</td>
					</tr>
					<tr>
						<th>Search address：</th>
						<td>
							<input name="ads" value="" type="text" placeholder="Please enter a search phrase" class="addressinput myinput"  autocomplete="off" onKeyUp="showAddress()" 
							datatype="*" nullmsg="Please enter a search phrase" errormsg="Please select a commonly used address"/>
							<span class="noaddress"></span>
						</td>
					</tr>				
					<tr>
						<th>&nbsp;</th>
						<td>
							<div class="addressdl">
								<dl></dl>
							</div>
						</td>
					</tr>	
					<tr>
						<th>Detail Address：</th>
						<td>
							<input type="text" value="{$detail.address}{$detail.detail}" id="detail" name="detail" class="myinput" placeholder="Please enter your English detail address into the" 
							datatype="*" nullmsg="Please enter your English detail address into the" errormsg="Please enter your English detail address into the"/>
						</td>
					</tr>
					<tr>
						<th></th>
						<td>
							<input type="submit" value="Edit"  class="btn_login " />
							<input type="reset"  value="Reset" class="btn_login reset" />
						</td>
					</tr>
					</tbody>
				</table>
			</form>
		</div>
		<!--member_right end-->
	</div>
	<!--content end-->
	
	<!--footer start-->
<script src="__PUBLIC__/Plugins/Validform/validform.min.js" ></script>
	<include file="Public:footer" lang="true" />
	<!--footer end-->
	<!--online start-->
		
	<!--online end-->
</div>
<script type="text/javascript">
	
	$(function(){
		$(".formTable").Validform({tiptype:function(msg,o,cssctl){
			var objtip=$("#Validform_errortip_div");cssctl(objtip,o.type);objtip.text(msg);}
			,tipmsg:{
					tit:"Prompt information",
					w:"Please input the correct information！",
					r:"Through the verification of the information！",
					c:"Checking information…",
					s:"Please fill in the information！",
					v:"The filled information has not been verified, please try later…",
					p:"Data are presented…",
					err:"Wrong! To address or return data format is wrong！",
					abort:"Ajax operation was canceled！"
			},
		});
		
		//地址删除
		$('.href').on('click',function(){
			var id = $(this).attr("rel"); 
			$.post("{:U('Member/address_index')}",{id:id});
		});
		
		//悬浮框显示隐藏
		$('.online').on('hover',function(){
			$('.online ul').toggle();
			//$('.rlico').toggleClass('rlico2');
		});
	
	});
	function showAddress(){
		var value  = $('.addressinput').val();
		var cityid = $('#city').val();
		if(value){
			$.get("{:U('Member/address_index')}",{value:value,cityid:cityid},function(data){
				
				if(data){
					$('.noaddress').html("");
					$('.addressdl dl').html(data);
					$('.addressdl').slideDown();
					
					$('.addressdl dl dd span').click(function(){
						var html      = $(this).text();
						var addid     = $(this).attr("did");
						var longitude = $(this).attr('longitude');
						var latitude  = $(this).attr('latitude');
						var cityid    = $(this).attr('cityid');

						$('.addressinput').val(html);
						$('#addressid').val(addid);
						$('#longitude').val(longitude);
						$('#latitude').val(latitude);
						$('#city').val(cityid);
						
						$('.addressdl').slideUp(function(){
							$('.address_choose').slideDown();
						});
					});
				}else{
					
					var html = "The address is not found, you can change a keyword";
					$('.noaddress').html(html);
					$('.addressdl').slideUp();
					$('.address_choose').slideUp();
				}
			});
		}else{
			$('.addressdl').slideUp();
			return false;
		}
	}
</script>	
</body>
</html>
